<HTML><HEAD><TITLE>current_struct(?Name, -Struct)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Syntax Settings</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>current_struct(?Name, -Struct)</H1>
Succeeds if Name is the name of a currently visible structure and Struct is its specification
<DL>
<DT><EM>Name</EM></DT>
<DD>Variable or atom
</DD>
<DT><EM>Struct</EM></DT>
<DD>Variable or structure.
</DD>
</DL>
<H2>Description</H2>
<P>
	Used to retrieve the definition of a defined structure, or to
	enumerate all visible structure definitions.
	</P><P>
	Visible structures are those which have either been declared locally,
	exported, or which have been imported or reexported from another module.
	</P>

<H3>Modes and Determinism</H3><UL>
<LI>current_struct(+, -) is semidet
<LI>current_struct(-, -) is nondet
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Fail Conditions</H3>
Name is not the name of a visible structure definition
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>Name is neither variable nor atom.
<DT><EM>(5) type error </EM>
<DD>Struct is neither variable nor structure.
</DL>
<H2>Examples</H2>
<PRE>
    :- local struct(employee(name,age,salary)).

    ?- current_struct(employee, Spec).
    Spec = employee(name, age, salary)
    yes.

    ?- current_struct(Name, Spec).
    Name = employee
    Spec = employee(name, age, salary)
    More (0.00s cpu) ? ;

    Name = suspend
    Spec = suspend(inst, constrained, bound)
    More (0.00s cpu) ? ;

    No (0.00s cpu)

    ?- current_struct(book, Spec).
    No (0.00s cpu)
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/modules/local-1.html">local / 1</A>, <A HREF="../../kernel/modules/export-1.html">export / 1</A>, <A HREF="../../kernel/syntax/struct-1.html">struct / 1</A>
</BODY></HTML>
